home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / aplictns / dkbtrace / part01 next >
Encoding:
Internet Message Format  |  1990-09-03  |  71.4 KB

  1. Path: abcfd20.larc.nasa.gov!amiga-request
  2. From: amiga-request@abcfd20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
  3. Subject: v90i249: DKBTrace 2.01 - DKBtrace Ray-Tracer, Part01/10
  4. Reply-To: David Schanen <mtv@milton.u.washington.edu>
  5. Newsgroups: comp.sources.amiga
  6. Message-ID: <comp.sources.amiga:v90i249@abcfd20.larc.nasa.gov>
  7. Date: 03 Sep 90 23:21:25 GMT
  8. Approved: tadguy@uunet.UU.NET (Tad Guy)
  9. X-Mail-Submissions-To: amiga@uunet.uu.net
  10. X-Post-Discussions-To: comp.sys.amiga
  11.  
  12. Submitted-by: David Schanen <mtv@milton.u.washington.edu>
  13. Posting-number: Volume 90, Issue 249
  14. Archive-name: applications/dkbtrace-2.01/part01
  15.  
  16. [ sample data files are in the comp.binaries.amiga postings  ...tad ]
  17.  
  18.      This program is a ray tracer written completely in C.  It supports
  19.      arbitrary quadric surfaces (spheres, ellipsoids, cones, cylinders,
  20.      planes, etc.), constructive solid geometry, and various shading models
  21.      (reflection, refraction, marble, wood, and many others).  It also has
  22.      special-case code to handle spheres, planes, triangles, and smooth
  23.      triangles.  By using these special primitives, the rendering can be done
  24.      much more quickly than by using the more general quadrics. 
  25.      In order to create pictures with this program, you must describe the   
  26.      objects in the world.  This description is a text file called   
  27.      "<filename>.data", and <filename> defaults to "object" if not specified.
  28.      Normally, such files are difficult to write and to read.  In order to
  29.      make this task easier, the program contains a two-pass parser to read
  30.      the data file.  It allows the user to easily create complex worlds from
  31.      simple components.  Since the parser allows include files, the user may
  32.      put the object descriptions into different files and combine them all
  33.      into one final image.
  34.  
  35.    The Amiga archive here contains two versions of the raytracer:
  36.  
  37.        traceffp   - Fast Floating Point version of the raytracer.
  38.                     This version will run on any Amiga with sufficient
  39.                     memory.
  40.  
  41.        trace881   - Math coprocessor version.  This version will only
  42.                     run on 68020 or 68030 based systems that have a
  43.                     68881 or 68882 math coprocessor.
  44.  
  45.    I usually like having a fairly large stack for this program.  If it
  46.    crashes on you, try inceasing the stack size.
  47.  
  48.    In addition, the following utilities are provided (these will run on any
  49.    AMIGA system).
  50.  
  51.        DumpToIFF  - Converts the raw 24 bit output files of the raytracer into
  52.                     hires HAM images.
  53.  
  54.        Dump2RGB   - Converts the raw 24 bit output files of the raytracer into
  55.                     three separate dump files for red, green and blue.
  56.  
  57.        Dump2Raw    - Same as Dump2RGB but takes the size from the input file
  58.                      and takes less memory.
  59.  
  60.        Sculpt2DKB  - Converts a Sculpt-Animate 3D .scene file into DKB format.
  61.               At the current time, smoothed triangles are not supported.  The
  62.               only information converted is the information on the polygons,
  63.               the colours, and the textures.  Lightsources, viewpoints, and
  64.               world information is currently ignored.
  65.  
  66. #!/bin/sh
  67. # This is a shell archive.  Remove anything before this line, then unpack
  68. # it by saving it into a file and typing "sh file".  To overwrite existing
  69. # files, type "sh file -c".  You can also feed this as standard input via
  70. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  71. # will see the following message at the end:
  72. #        "End of archive 1 (of 10)."
  73. # Contents:  Docs Docs/AmigaUtils.doc Docs/Porting.doc Docs/read.me
  74. #   Docs/trace.def Docs/unixreadme.doc src src/DKB.LNK src/DKB87.LNK
  75. #   src/Dump2Raw.c src/amigaconf.h src/colour.c src/config.h
  76. #   src/dumproto.h src/dumptoiff.h src/ibmconf.h src/packer.c
  77. #   src/putpict.c src/ray.c src/read.me src/showprioq.h src/unix.c
  78. #   src/unixconf.h src/vector.h src/viewpnt.c src/withfile
  79. # Wrapped by tadguy@abcfd20 on Mon Sep  3 19:21:14 1990
  80. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  81. if test ! -d 'Docs' ; then
  82.     echo shar: Creating directory \"'Docs'\"
  83.     mkdir 'Docs'
  84. fi
  85. if test -f 'Docs/AmigaUtils.doc' -a "${1}" != "-c" ; then 
  86.   echo shar: Will not clobber existing file \"'Docs/AmigaUtils.doc'\"
  87. else
  88. echo shar: Extracting \"'Docs/AmigaUtils.doc'\" \(1605 characters\)
  89. sed "s/^X//" >'Docs/AmigaUtils.doc' <<'END_OF_FILE'
  90. XThe following utilities are provided for the Amiga computer.  Some of these
  91. Xmay be useful on other systems as well if you can get hold of Amiga-format
  92. Xdata files.
  93. X
  94. X
  95. XThese utilities are freely distributable.  See DKB.DOC for complete
  96. Xcopyright and distribution information.
  97. X
  98. X
  99. X
  100. XDumpToIFF   - Converts the raw 24 bit output files of the raytracer into
  101. X              hires HAM images.
  102. X               syntax:
  103. X                DumpToIFF  [options] input-file [output-file [palette-file]] 
  104. X
  105. X               options are:
  106. X                    -d            Suppress Floyd Steinberg dithering
  107. X                    -pfilename    Output a colour palette for the picture
  108. X
  109. X              The colour palette for one image may be used in other images.
  110. X              This is useful for animations in order to force the entire
  111. X              animation to use the same colour palette.
  112. X
  113. X                 eg.
  114. X                   DumpToIFF  -pmyImage.palette myImage.dis  myImage.ham
  115. X                   DumpToIFF  myImage2.dis  myImage2.ham  myImage.palette
  116. X
  117. X
  118. XSculpt2DKB  - Converts a Sculpt-Animate 3D .scene file into DKB format.  At
  119. X              the current time, smoothed triangles are not supported.  The
  120. X              only information converted is the information on the polygons,
  121. X              the colours, and the textures.  Lightsources, viewpoints, and
  122. X              world information is currently ignored.
  123. X
  124. X                syntax:
  125. X                   Sculpt2DKB  scene-file  dkb-dat-file
  126. X
  127. X              You must edit this file after the conversion to add a viewpoint
  128. X              and lightsources as needed.
  129. X
  130. XDavid Buck
  131. END_OF_FILE
  132. if test 1605 -ne `wc -c <'Docs/AmigaUtils.doc'`; then
  133.     echo shar: \"'Docs/AmigaUtils.doc'\" unpacked with wrong size!
  134. fi
  135. # end of 'Docs/AmigaUtils.doc'
  136. fi
  137. if test -f 'Docs/Porting.doc' -a "${1}" != "-c" ; then 
  138.   echo shar: Will not clobber existing file \"'Docs/Porting.doc'\"
  139. else
  140. echo shar: Extracting \"'Docs/Porting.doc'\" \(2760 characters\)
  141. sed "s/^X//" >'Docs/Porting.doc' <<'END_OF_FILE'
  142. X
  143. X
  144. X
  145. X                       Porting DKBTrace to Other Platforms
  146. X
  147. X
  148. X   The 2.0 version of DKBTrace is much more portable than pervious versions.
  149. X   In order to port the ray tracer to different systems, you should only
  150. X   need to create two files:
  151. X
  152. X     <system>-config.h    - This is a system-specific header file which
  153. X                            defines all constants and macros for the
  154. X                            raytracer.  Currently, there are config files
  155. X                            for the Amiga, IBM Turbo C, and Unix.
  156. X
  157. X     <system>.c           - This module contains all system-specific
  158. X                            code and variables.
  159. X
  160. X   In the system.c file, you must define four functions:
  161. X
  162. X     void display_init (void);
  163. X            - initialize the display for drawing the image
  164. X
  165. X     void display_plot (int x, int y, char Red, char Green, char Blue);
  166. X            - display the given colour at the given x,y coordinates
  167. X
  168. X     void display_finished (void);
  169. X            - perform any operations necessary after the raytracing is
  170. X              finished.
  171. X
  172. X     void display_close (void);
  173. X            - close the display
  174. X
  175. X
  176. X    The display_finished routine is called before the raytracer prompts
  177. X    the user to hit return to finish at the end of the raytrace.  On the
  178. X    Amiga, this function closes the requestor that allowed the raytracer
  179. X    to be halted prematurely.  On most other systems, this function would
  180. X    be an empty function.
  181. X
  182. X
  183. X    DKBTrace version 2.0 uses ANSI prototypes to perform parameter type
  184. X    checking.  If your compiler doesn't support ANSI prototypes, then
  185. X    place the following line in your system-congig.h file:
  186. X
  187. X       #define PARAMS ()
  188. X
  189. X    If your compiler does support prototypes, place the following line
  190. X    in the system-config.h file:
  191. X
  192. X       #define PARAMS x
  193. X
  194. X
  195. X
  196. X    NOTE:  Before compiling on a new system, rename your system-config.h
  197. X           file to config.h
  198. X
  199. X
  200. X
  201. X    One final request:
  202. X      If you are porting to another system, PLEASE try to change only the
  203. X      two files that you created.  If you must make changes elsewhere in
  204. X      the system, first ask yourself "Is there any way I can do this by
  205. X      just changing the header file?"  If there is, then do it.  If there
  206. X      is absolutely no way you can get it to work otherwise, then you can
  207. X      change code elsewhere in the system.  I would appreciate it if the
  208. X      raytracer remained as portable as possible.
  209. X
  210. X
  211. X   If you port the system to another platform, please send me the modified
  212. X   files.  I would like to keep them in case I get requests for ports to
  213. X   that system.  Keep in mind, that any ports must be made freely
  214. X   distributable and source code must be available free of charge to anyone
  215. X   who wants it.
  216. X
  217. X
  218. XThanks.
  219. XDavid Buck
  220. END_OF_FILE
  221. if test 2760 -ne `wc -c <'Docs/Porting.doc'`; then
  222.     echo shar: \"'Docs/Porting.doc'\" unpacked with wrong size!
  223. fi
  224. # end of 'Docs/Porting.doc'
  225. fi
  226. if test -f 'Docs/read.me' -a "${1}" != "-c" ; then 
  227.   echo shar: Will not clobber existing file \"'Docs/read.me'\"
  228. else
  229. echo shar: Extracting \"'Docs/read.me'\" \(3796 characters\)
  230. sed "s/^X//" >'Docs/read.me' <<'END_OF_FILE'
  231. X
  232. X                                DKBTrace
  233. X
  234. X
  235. X
  236. X
  237. X   This ray tracer was written by David K. Buck and is released as freely
  238. X   distributable software.  The author retains all copyrights but permits
  239. X   free distribution of the software through any medium.  The software may
  240. X   be used without charge so long as the code is not included in any 
  241. X   commercial product.
  242. X
  243. X
  244. X   The Amiga archive here contains two versions of the raytracer:
  245. X
  246. X       traceffp   - Fast Floating Point version of the raytracer.
  247. X                    This version will run on any Amiga with sufficient
  248. X                    memory.
  249. X
  250. X       trace881   - Math coprocessor version.  This version will only
  251. X                    run on 68020 or 68030 based systems that have a
  252. X                    68881 or 68882 math coprocessor.
  253. X
  254. X
  255. X   I usually like having a fairly large stack for this program.  If it
  256. X   crashes on you, try inceasing the stack size.
  257. X
  258. X
  259. X   In addition, the following utilities are provided (these will run on any
  260. X   AMIGA system).
  261. X
  262. X       DumpToIFF  - Converts the raw 24 bit output files of the raytracer into
  263. X                    hires HAM images.
  264. X               syntax:
  265. X                DumpToIFF  [options] input-file [output-file [palette-file]] 
  266. X
  267. X               options are:
  268. X                    -d            Suppress Floyd Steinberg dithering
  269. X                    -pfilename    Output a colour palette for the picture
  270. X
  271. X              The colour palette for one image may be used in other images.
  272. X              This is useful for animations in order to force the entire
  273. X              animation to use the same colour palette.
  274. X
  275. X                 eg.
  276. X                   DumpToIFF  -pmyImage.palette myImage.dis  myImage.ham
  277. X                   DumpToIFF  myImage2.dis  myImage2.ham  myImage.palette
  278. X
  279. X
  280. X       Dump2RGB   - Converts the raw 24 bit output files of the raytracer into
  281. X                    three separate dump files for red, green and blue.
  282. X               syntax:
  283. X                Dump2RGB [options] input-file
  284. X
  285. X               options are:
  286. X                    -wxxx         Output image width
  287. X                    -hxxx         Output image height
  288. X
  289. X       Dump2Raw    - Same as Dump2RGB but takes the size from the input file
  290. X                     and takes less memory.
  291. X       Sculpt2DKB  - Converts a Sculpt-Animate 3D .scene file into DKB format.
  292. X              At the current time, smoothed triangles are not supported.  The
  293. X              only information converted is the information on the polygons,
  294. X              the colours, and the textures.  Lightsources, viewpoints, and
  295. X              world information is currently ignored.
  296. X
  297. X                syntax:
  298. X                   Sculpt2DKB  scene-file  dkb-dat-file
  299. X
  300. X              You must edit this file after the conversion to add a viewpoint
  301. X              and lightsources as needed.
  302. X
  303. X
  304. X   The program documentation can be found in the file DKB.DOC and the
  305. X   documentation for some Amiga specific utilities may be found in
  306. X   AmigaUtils.doc.
  307. X
  308. X   This program is being distributed in four separate packages:
  309. X
  310. X
  311. X      DKBTrace.lzh:  Executables for traceffp and trace881
  312. X                     documentation files
  313. X                     DumpToIFF and Sculpt2DKB executables
  314. X
  315. X      DKBData.lzh    Many sample data files
  316. X
  317. X      DKBSource.lzh  Source code for DKBTrace, Amiga utilities, and
  318. X                     IBM Utilities.
  319. X
  320. X
  321. X      DKBPics.lzh    Sample pictures produced by the raytracer.
  322. X                     (you could render these yourself using the
  323. X                      data files in the DKBTrace.lzh archive)
  324. X
  325. X
  326. X   There is a document in the DKBTrace.lzh archive which describes the
  327. X   conversions required to use data files for DKBTrace version 1.2 with
  328. X   the new 2.0 version.  This file is called 12to20.doc
  329. X
  330. X   This readme file is in all three archives.
  331. END_OF_FILE
  332. if test 3796 -ne `wc -c <'Docs/read.me'`; then
  333.     echo shar: \"'Docs/read.me'\" unpacked with wrong size!
  334. fi
  335. # end of 'Docs/read.me'
  336. fi
  337. if test -f 'Docs/trace.def' -a "${1}" != "-c" ; then 
  338.   echo shar: Will not clobber existing file \"'Docs/trace.def'\"
  339. else
  340. echo shar: Extracting \"'Docs/trace.def'\" \(33 characters\)
  341. sed "s/^X//" >'Docs/trace.def' <<'END_OF_FILE'
  342. X-w319 -h400 +v +d -t +p -e +a0.3
  343. END_OF_FILE
  344. if test 33 -ne `wc -c <'Docs/trace.def'`; then
  345.     echo shar: \"'Docs/trace.def'\" unpacked with wrong size!
  346. fi
  347. # end of 'Docs/trace.def'
  348. fi
  349. if test -f 'Docs/unixreadme.doc' -a "${1}" != "-c" ; then 
  350.   echo shar: Will not clobber existing file \"'Docs/unixreadme.doc'\"
  351. else
  352. echo shar: Extracting \"'Docs/unixreadme.doc'\" \(831 characters\)
  353. sed "s/^X//" >'Docs/unixreadme.doc' <<'END_OF_FILE'
  354. XThis text file is to help people with UNIX systems compile DKBTrace.  The
  355. Xraytracer was originally written for Amiga systems and was made portable to
  356. XIBM's and UNIX systems.  Due to the wide variety of UNIX systems, however,
  357. Xit is difficult to make the code truly portable from system to system.
  358. X
  359. XFor a SUN 4, the instructions are as follows:
  360. X   1) cp unixconfig.h config.h
  361. X   2) Edit config.h and add the line:
  362. X        #define volatile
  363. X      (to compensate for stupid compilers)
  364. X   3) Take the unixmakefile supplied in this directory and rename
  365. X      it to Makefile.
  366. X   4) Type "make"
  367. XHopefully, everything will work.  The output file format is very similar to
  368. XQRT format except that the colours range from 0 to 255 instead of 0 to 127.
  369. XWith the proper modifications, the Fuzzy Bit Map tools can display the
  370. Xresulting images.
  371. END_OF_FILE
  372. if test 831 -ne `wc -c <'Docs/unixreadme.doc'`; then
  373.     echo shar: \"'Docs/unixreadme.doc'\" unpacked with wrong size!
  374. fi
  375. # end of 'Docs/unixreadme.doc'
  376. fi
  377. if test ! -d 'src' ; then
  378.     echo shar: Creating directory \"'src'\"
  379.     mkdir 'src'
  380. fi
  381. if test -f 'src/DKB.LNK' -a "${1}" != "-c" ; then 
  382.   echo shar: Will not clobber existing file \"'src/DKB.LNK'\"
  383. else
  384. echo shar: Extracting \"'src/DKB.LNK'\" \(213 characters\)
  385. sed "s/^X//" >'src/DKB.LNK' <<'END_OF_FILE'
  386. Xc:\lib\c0l+trace+render+tokenize+parse+objects+spheres+quadrics+triangle+
  387. Xlighting+prioq+texture+matrices+csg+colour+viewpnt+ray+planes+iff+gif+
  388. Xgifdecod+raw+ibm
  389. Xdkb
  390. Xdkb/m
  391. Xc:\lib\emu+c:\lib\mathl+c:\lib\cl;
  392. END_OF_FILE
  393. if test 213 -ne `wc -c <'src/DKB.LNK'`; then
  394.     echo shar: \"'src/DKB.LNK'\" unpacked with wrong size!
  395. fi
  396. # end of 'src/DKB.LNK'
  397. fi
  398. if test -f 'src/DKB87.LNK' -a "${1}" != "-c" ; then 
  399.   echo shar: Will not clobber existing file \"'src/DKB87.LNK'\"
  400. else
  401. echo shar: Extracting \"'src/DKB87.LNK'\" \(214 characters\)
  402. sed "s/^X//" >'src/DKB87.LNK' <<'END_OF_FILE'
  403. Xc:\lib\c0l+trace+render+tokenize+parse+objects+spheres+quadrics+triangle+
  404. Xlighting+prioq+texture+matrices+csg+colour+viewpnt+ray+planes+iff+gif+
  405. Xgifdecod+raw+ibm
  406. Xdkb
  407. Xdkb/m
  408. Xc:\lib\fp87+c:\lib\mathl+c:\lib\cl;
  409. END_OF_FILE
  410. if test 214 -ne `wc -c <'src/DKB87.LNK'`; then
  411.     echo shar: \"'src/DKB87.LNK'\" unpacked with wrong size!
  412. fi
  413. # end of 'src/DKB87.LNK'
  414. fi
  415. if test -f 'src/Dump2Raw.c' -a "${1}" != "-c" ; then 
  416.   echo shar: Will not clobber existing file \"'src/Dump2Raw.c'\"
  417. else
  418. echo shar: Extracting \"'src/Dump2Raw.c'\" \(4320 characters\)
  419. sed "s/^X//" >'src/Dump2Raw.c' <<'END_OF_FILE'
  420. X/**********************************************************
  421. X
  422. XDUMP2RAW.C  - Converts a DKB/QRT "Dump" format raw file to
  423. X          PICLAB's "raw" format, which is 3 files of
  424. X          8-Bit pixel data named .R8, .B8, and .G8.
  425. X          On the Amiga, names are .red, .grn, and .blu.
  426. X          By Aaron A. Collins, written on 6/30/90
  427. X
  428. X          This file is released to the Public Domain.
  429. X
  430. X          PICLAB is a trademark of The Stone Soup Group.
  431. X      
  432. X ***********************************************************/
  433. X
  434. X#include <stdio.h>
  435. X#include <string.h>
  436. X#include "config.h"
  437. X
  438. X#ifndef TRUE
  439. X#define TRUE 1
  440. X#define FALSE 0
  441. X#endif
  442. X
  443. X/* #define IBM TRUE */
  444. X
  445. X#define Amiga TRUE
  446. X
  447. X#define MAXXRES 2048   /* huge max x resolution allowable, infinite y res. */
  448. X
  449. Xunsigned char linbuf[MAXXRES * 3];
  450. X
  451. Xvoid main(argc,argv)
  452. Xint argc;
  453. Xchar *argv[];
  454. X{
  455. X    int xres, yres, xhi, yhi, noext = FALSE;
  456. X    register int x, y;
  457. X    char inname[80], rname[80], bname[80], gname[80], tmpname[80];
  458. X    FILE *in, *rout, *bout, *gout;
  459. X
  460. X    printf("\n\nDKB/QRT Image File to Raw R-G-B Files Converter\n");
  461. X    printf("By Aaron A. Collins.  Written 6/30/90\n\n");
  462. X
  463. X    if (argc < 2)
  464. X    {
  465. X        printf("Usage: %s InFile[.DIS]\n\n",argv[0]);
  466. X        exit(1);
  467. X    }
  468. X
  469. X    strcpy(inname, argv[1]);      /* get input filename */
  470. X
  471. X    strcpy(tmpname, inname);
  472. X    strupr(tmpname);        /* Cvt to uppercase */
  473. X    if (!strstr(tmpname, ".DIS"))    /* if user didn't supply .DIS ext, */
  474. X        if (!strchr(tmpname, '.'))  /* AND didn't supply ANY ext */
  475. X        {
  476. X            noext = TRUE;
  477. X            strcat(inname, ".DIS");
  478. X        }
  479. X
  480. X    if ((in = fopen(inname, "rb")) == NULL)  /* try w/supplied ext. */
  481. X    {
  482. X        printf("ERROR - Couldn't open file %s\n", inname);
  483. X        exit(1);
  484. X    }
  485. X
  486. X    if (noext)
  487. X    {
  488. X        strcpy(rname, argv[1]);        /* copy name w/no extension */
  489. X        strcpy(gname, argv[1]);
  490. X        strcpy(bname, argv[1]);
  491. X    }
  492. X    else
  493. X    {
  494. X        strcpy(tmpname, argv[1]);    /* Get Input Filename */
  495. X        strupr(tmpname);        /* Cvt to uppercase */
  496. X        *strchr(tmpname, '.') = '\0';    /* Find the Dot + Truncate */
  497. X        strcpy(rname, tmpname);        /* copy name w/no extension */
  498. X        strcpy(gname, tmpname);
  499. X        strcpy(bname, tmpname);
  500. X    }
  501. X#ifdef IBM
  502. X    strcat(rname, ".R8");
  503. X    strcat(gname, ".G8");
  504. X    strcat(bname, ".B8");
  505. X#endif
  506. X
  507. X#ifdef Amiga
  508. X    strcat(rname, ".red");
  509. X    strcat(gname, ".grn");
  510. X    strcat(bname, ".blu");
  511. X#endif
  512. X    
  513. X    if ((rout = fopen(rname, "wb")) == NULL)
  514. X    {
  515. X        printf("ERROR - Couldn't create file %s\n", rname);
  516. X        fclose(in);
  517. X        exit(1);
  518. X    }
  519. X
  520. X    if ((gout = fopen(gname, "wb")) == NULL)
  521. X    {
  522. X        printf("ERROR - Couldn't create file %s\n", gname);
  523. X        fclose(in);
  524. X        fclose(rout);
  525. X        exit(1);
  526. X    }
  527. X
  528. X    if ((bout = fopen(bname, "wb")) == NULL)
  529. X    {
  530. X        printf("ERROR - Couldn't create file %s\n", bname);
  531. X        fclose(in);
  532. X        fclose(rout);
  533. X        fclose(gout);
  534. X        exit(1);
  535. X    }
  536. X
  537. X    /** load x and y resolution from input DUMP file **/
  538. X
  539. X    xres = fgetc(in);            /* lo order */
  540. X    xhi = fgetc(in);            /* hi order */
  541. X    xres += ((unsigned int) xhi) << 8;
  542. X    
  543. X    if (xres > MAXXRES)            /* too big? */
  544. X    {
  545. X        printf("ERROR - X res. of %s (%d) exceeds maximum (%d)!\n", inname, xres, MAXXRES);
  546. X        fclose(in);            /* close all files */
  547. X        fclose(rout);
  548. X        fclose(gout);
  549. X        fclose(bout);
  550. X        unlink(rname);        /* delete empty out files */
  551. X        unlink(gname);
  552. X        unlink(bname);
  553. X        exit(1);
  554. X    }
  555. X
  556. X    yres = fgetc(in);            /* now do yres the same... */
  557. X    yhi = fgetc(in);
  558. X    yres += ((unsigned int) yhi) << 8;
  559. X
  560. X    printf("Input file         = %s\n", inname);    /* show stats */
  561. X    printf("Output files       = %s\n", rname);
  562. X    printf("                     %s\n", gname);
  563. X    printf("                     %s\n\n", bname);
  564. X    printf("Image X resolution = %d\n", xres);
  565. X    printf("Image Y resolution = %d\n", yres);
  566. X
  567. X    printf("\nProcessing Line:   0");
  568. X
  569. X    for (y = 0; y < yres; y++)    /* for every line in the old file */
  570. X    {
  571. X
  572. X        printf("\b\b\b%3d", y);        /* disp. current line # */
  573. X
  574. X        fread(linbuf, 1, 2, in);    /* read in line number */
  575. X
  576. X        if (feof(in))            /* stop if file truncated */
  577. X            break;
  578. X
  579. X        for (x = 0; x < 3; x++)
  580. X        {
  581. X            fread(linbuf, 1, xres, in); /* read a line's data */
  582. X
  583. X            if (feof(in))        /* stop if file truncated */
  584. X                break;
  585. X
  586. X            switch (x)
  587. X            {
  588. X                case 0:
  589. X                    fwrite(linbuf, 1, xres, rout);
  590. X                    break;
  591. X                case 1:
  592. X                    fwrite(linbuf, 1, xres, gout);
  593. X                    break;
  594. X                case 2:
  595. X                    fwrite(linbuf, 1, xres, bout);
  596. X                    break;
  597. X            }
  598. X        }
  599. X    }
  600. X    printf("\n");
  601. X    fclose(in);                                 /* close all files */
  602. X    fflush(rout);
  603. X    fflush(gout);
  604. X    fflush(bout);
  605. X    fclose(rout);
  606. X    fclose(gout);
  607. X    fclose(bout);
  608. X    exit(0);
  609. X}
  610. END_OF_FILE
  611. if test 4320 -ne `wc -c <'src/Dump2Raw.c'`; then
  612.     echo shar: \"'src/Dump2Raw.c'\" unpacked with wrong size!
  613. fi
  614. # end of 'src/Dump2Raw.c'
  615. fi
  616. if test -f 'src/amigaconf.h' -a "${1}" != "-c" ; then 
  617.   echo shar: Will not clobber existing file \"'src/amigaconf.h'\"
  618. else
  619. echo shar: Extracting \"'src/amigaconf.h'\" \(2335 characters\)
  620. sed "s/^X//" >'src/amigaconf.h' <<'END_OF_FILE'
  621. X/*****************************************************************************
  622. X*
  623. X*                                 amigaconf.h
  624. X*
  625. X*   from DKBTrace (c) 1990  David Buck
  626. X*
  627. X*  This module contains Amiga-specific defines, types, and other declarations.
  628. X*
  629. X* This software is freely distributable. The source and/or object code may be
  630. X* copied or uploaded to communications services so long as this notice remains
  631. X* at the top of each file.  If any changes are made to the program, you must
  632. X* clearly indicate in the documentation and in the programs startup message
  633. X* who it was who made the changes. The documentation should also describe what
  634. X* those changes were. This software may not be included in whole or in
  635. X* part into any commercial package without the express written consent of the
  636. X* author.  It may, however, be included in other public domain or freely
  637. X* distributed software so long as the proper credit for the software is given.
  638. X*
  639. X* This software is provided as is without any guarantees or warranty. Although
  640. X* the author has attempted to find and correct any bugs in the software, he
  641. X* is not responsible for any damage caused by the use of the software.  The
  642. X* author is under no obligation to provide service, corrections, or upgrades
  643. X* to this package.
  644. X*
  645. X* Despite all the legal stuff above, if you do find bugs, I would like to hear
  646. X* about them.  Also, if you have any comments or questions, you may contact me
  647. X* at the following address:
  648. X*
  649. X*     David Buck
  650. X*     22C Sonnet Cres.
  651. X*     Nepean Ontario
  652. X*     Canada, K2H 8W7
  653. X*
  654. X*  I can also be reached on the following bulleton boards:
  655. X*
  656. X*     ATX              (613) 526-4141
  657. X*     OMX              (613) 731-3419
  658. X*     Mystic           (613) 731-0088 or (613) 731-6698
  659. X*
  660. X*  Fidonet:   1:163/109.9
  661. X*  Internet:  David_Buck@Carleton.CA
  662. X*
  663. X*  IBM Port by Aaron A. Collins. Aaron may be reached on the following BBS'es:
  664. X*
  665. X*     Lattice BBS                      (708) 916-1200
  666. X*     The Information Exchange BBS     (708) 945-5575
  667. X*     Stillwaters BBS                  (708) 403-2826
  668. X*
  669. X*****************************************************************************/
  670. X
  671. X
  672. X/* For the Amiga, we can use ANSI prototype definitions. */
  673. X
  674. X#define PARAMS(x) x
  675. Xvoid main (int, char**);
  676. Xvoid exit(int);
  677. Xvoid *malloc(int);
  678. Xvoid free(void *);
  679. X
  680. Xextern int _bufsiz;
  681. X#define BUFSIZ _bufsiz
  682. END_OF_FILE
  683. if test 2335 -ne `wc -c <'src/amigaconf.h'`; then
  684.     echo shar: \"'src/amigaconf.h'\" unpacked with wrong size!
  685. fi
  686. # end of 'src/amigaconf.h'
  687. fi
  688. if test -f 'src/colour.c' -a "${1}" != "-c" ; then 
  689.   echo shar: Will not clobber existing file \"'src/colour.c'\"
  690. else
  691. echo shar: Extracting \"'src/colour.c'\" \(3722 characters\)
  692. sed "s/^X//" >'src/colour.c' <<'END_OF_FILE'
  693. X/*****************************************************************************
  694. X*
  695. X*                                   colour.c
  696. X*
  697. X*   from DKBTrace (c) 1990  David Buck
  698. X*
  699. X*  This module implements routines to manipulate colours.
  700. X*
  701. X* This software is freely distributable. The source and/or object code may be
  702. X* copied or uploaded to communications services so long as this notice remains
  703. X* at the top of each file.  If any changes are made to the program, you must
  704. X* clearly indicate in the documentation and in the programs startup message
  705. X* who it was who made the changes. The documentation should also describe what
  706. X* those changes were. This software may not be included in whole or in
  707. X* part into any commercial package without the express written consent of the
  708. X* author.  It may, however, be included in other public domain or freely
  709. X* distributed software so long as the proper credit for the software is given.
  710. X*
  711. X* This software is provided as is without any guarantees or warranty. Although
  712. X* the author has attempted to find and correct any bugs in the software, he
  713. X* is not responsible for any damage caused by the use of the software.  The
  714. X* author is under no obligation to provide service, corrections, or upgrades
  715. X* to this package.
  716. X*
  717. X* Despite all the legal stuff above, if you do find bugs, I would like to hear
  718. X* about them.  Also, if you have any comments or questions, you may contact me
  719. X* at the following address:
  720. X*
  721. X*     David Buck
  722. X*     22C Sonnet Cres.
  723. X*     Nepean Ontario
  724. X*     Canada, K2H 8W7
  725. X*
  726. X*  I can also be reached on the following bulleton boards:
  727. X*
  728. X*     ATX              (613) 526-4141
  729. X*     OMX              (613) 731-3419
  730. X*     Mystic           (613) 731-0088 or (613) 731-6698
  731. X*
  732. X*  Fidonet:   1:163/109.9
  733. X*  Internet:  David_Buck@Carleton.CA
  734. X*
  735. X*  IBM Port by Aaron A. Collins. Aaron may be reached on the following BBS'es:
  736. X*
  737. X*     Lattice BBS                      (708) 916-1200
  738. X*     The Information Exchange BBS     (708) 945-5575
  739. X*     Stillwaters BBS                  (708) 403-2826
  740. X*
  741. X*****************************************************************************/
  742. X
  743. X
  744. X#include "frame.h"
  745. X#include "vector.h"
  746. X#include "dkbproto.h"
  747. X
  748. X#define FABS(x) ((x) < 0.0 ? (0.0 - (x)) : (x))
  749. X
  750. XDBL Colour_Distance (colour1, colour2)
  751. X   COLOUR *colour1, *colour2;
  752. X   {
  753. X   return (FABS (colour1->Red - colour2->Red)
  754. X         + FABS (colour1->Green - colour2->Green)
  755. X         + FABS (colour1->Blue - colour2->Blue));
  756. X   }
  757. X
  758. Xvoid Add_Colour (result, colour1, colour2)
  759. X   COLOUR *result, *colour1, *colour2;
  760. X   {
  761. X   result->Red = colour1->Red + colour2->Red;
  762. X   result->Green = colour1->Green + colour2->Green;
  763. X   result->Blue = colour1->Blue + colour2->Blue;
  764. X   result->Alpha = colour1->Alpha + colour2->Alpha;
  765. X   }
  766. X
  767. Xvoid Scale_Colour (result, colour, factor)
  768. X   COLOUR *result, *colour;
  769. X   DBL factor;
  770. X   {
  771. X   result->Red = colour->Red * factor;
  772. X   result->Green = colour->Green * factor;
  773. X   result->Blue = colour->Blue * factor;
  774. X   result->Alpha = colour->Alpha * factor;
  775. X   }
  776. X
  777. Xvoid Clip_Colour (result, colour)
  778. X   COLOUR *result, *colour;
  779. X   {
  780. X   if (colour -> Red > 1.0)
  781. X      result -> Red = 1.0;
  782. X   else if (colour -> Red < 0.0)
  783. X      result -> Red = 0.0;
  784. X   else result -> Red = colour -> Red;
  785. X
  786. X   if (colour -> Green > 1.0)
  787. X      result -> Green = 1.0;
  788. X   else if (colour -> Green < 0.0)
  789. X      result -> Green = 0.0;
  790. X   else result -> Green = colour -> Green;
  791. X
  792. X   if (colour -> Blue > 1.0)
  793. X      result -> Blue = 1.0;
  794. X   else if (colour -> Blue < 0.0)
  795. X      result -> Blue = 0.0;
  796. X   else result -> Blue = colour -> Blue;
  797. X
  798. X   if (colour -> Alpha > 1.0)
  799. X      result -> Alpha = 1.0;
  800. X   else if (colour -> Alpha < 0.0)
  801. X      result -> Alpha = 0.0;
  802. X   else result -> Alpha = colour -> Alpha;
  803. X   }
  804. END_OF_FILE
  805. if test 3722 -ne `wc -c <'src/colour.c'`; then
  806.     echo shar: \"'src/colour.c'\" unpacked with wrong size!
  807. fi
  808. # end of 'src/colour.c'
  809. fi
  810. if test -f 'src/config.h' -a "${1}" != "-c" ; then 
  811.   echo shar: Will not clobber existing file \"'src/config.h'\"
  812. else
  813. echo shar: Extracting \"'src/config.h'\" \(2291 characters\)
  814. sed "s/^X//" >'src/config.h' <<'END_OF_FILE'
  815. X/*****************************************************************************
  816. X*
  817. X*                                 amigaconf.h
  818. X*
  819. X*   from DKBTrace (c) 1990  David Buck
  820. X*
  821. X*  This module contains Amiga-specific defines, types, and other declarations.
  822. X*
  823. X* This software is freely distributable. The source and/or object code may be
  824. X* copied or uploaded to communications services so long as this notice remains
  825. X* at the top of each file.  If any changes are made to the program, you must
  826. X* clearly indicate in the documentation and in the programs startup message
  827. X* who it was who made the changes. The documentation should also describe what
  828. X* those changes were. This software may not be included in whole or in
  829. X* part into any commercial package without the express written consent of the
  830. X* author.  It may, however, be included in other public domain or freely
  831. X* distributed software so long as the proper credit for the software is given.
  832. X*
  833. X* This software is provided as is without any guarantees or warranty. Although
  834. X* the author has attempted to find and correct any bugs in the software, he
  835. X* is not responsible for any damage caused by the use of the software.  The
  836. X* author is under no obligation to provide service, corrections, or upgrades
  837. X* to this package.
  838. X*
  839. X* Despite all the legal stuff above, if you do find bugs, I would like to hear
  840. X* about them.  Also, if you have any comments or questions, you may contact me
  841. X* at the following address:
  842. X*
  843. X*     David Buck
  844. X*     22C Sonnet Cres.
  845. X*     Nepean Ontario
  846. X*     Canada, K2H 8W7
  847. X*
  848. X*  I can also be reached on the following bulleton boards:
  849. X*
  850. X*     ATX              (613) 526-4141
  851. X*     OMX              (613) 731-3419
  852. X*     Mystic           (613) 731-0088 or (613) 731-6698
  853. X*
  854. X*  Fidonet:   1:163/109.9
  855. X*  Internet:  David_Buck@Carleton.CA
  856. X*
  857. X*  IBM Port by Aaron A. Collins. Aaron may be reached on the following BBS'es:
  858. X*
  859. X*     Lattice BBS                      (708) 916-1200
  860. X*     The Information Exchange BBS     (708) 945-5575
  861. X*     Stillwaters BBS                  (708) 403-2826
  862. X*
  863. X*****************************************************************************/
  864. X
  865. X
  866. X/* For the Amiga, we can use ANSI prototype definitions. */
  867. X
  868. X#define PARAMS(x) x
  869. Xvoid main (int, char**);
  870. Xvoid exit(int);
  871. Xvoid *malloc(int);
  872. Xvoid free(void *);
  873. END_OF_FILE
  874. if test 2291 -ne `wc -c <'src/config.h'`; then
  875.     echo shar: \"'src/config.h'\" unpacked with wrong size!
  876. fi
  877. # end of 'src/config.h'
  878. fi
  879. if test -f 'src/dumproto.h' -a "${1}" != "-c" ; then 
  880.   echo shar: Will not clobber existing file \"'src/dumproto.h'\"
  881. else
  882. echo shar: Extracting \"'src/dumproto.h'\" \(2971 characters\)
  883. sed "s/^X//" >'src/dumproto.h' <<'END_OF_FILE'
  884. X/*****************************************************************************
  885. X*
  886. X*                                   dumproto.h
  887. X*
  888. X*   from DKBTrace (c) 1990  David Buck
  889. X*
  890. X*  This file contains prototypes for DumpToIFF
  891. X*
  892. X* This software is freely distributable. The source and/or object code may be
  893. X* copied or uploaded to communications services so long as this notice remains
  894. X* at the top of each file.  If any changes are made to the program, you must
  895. X* clearly indicate in the documentation and in the programs startup message
  896. X* who it was who made the changes. The documentation should also describe what
  897. X* those changes were. This software may not be included in whole or in
  898. X* part into any commercial package without the express written consent of the
  899. X* author.  It may, however, be included in other public domain or freely
  900. X* distributed software so long as the proper credit for the software is given.
  901. X*
  902. X* This software is provided as is without any guarantees or warranty. Although
  903. X* the author has attempted to find and correct any bugs in the software, he
  904. X* is not responsible for any damage caused by the use of the software.  The
  905. X* author is under no obligation to provide service, corrections, or upgrades
  906. X* to this package.
  907. X*
  908. X* Despite all the legal stuff above, if you do find bugs, I would like to hear
  909. X* about them.  Also, if you have any comments or questions, you may contact me
  910. X* at the following address:
  911. X*
  912. X*     David Buck
  913. X*     22C Sonnet Cres.
  914. X*     Nepean Ontario
  915. X*     Canada, K2H 8W7
  916. X*
  917. X*  I can also be reached on the following bulleton boards:
  918. X*
  919. X*     ATX              (613) 526-4141
  920. X*     OMX              (613) 731-3419
  921. X*     Mystic           (613) 731-0088 or (613) 731-6698
  922. X*
  923. X*  Fidonet:   1:163/109.9
  924. X*  Internet:  David_Buck@Carleton.CA
  925. X*
  926. X*
  927. X*****************************************************************************/
  928. X
  929. X/* Prototypes from DumpToIFF.c */
  930. X
  931. Xvoid display_close (void);
  932. Xvoid display_plot (LONG x, LONG y, LONG new_red, LONG new_green, LONG new_blue);
  933. Xvoid process (LONG x, LONG y, LONG new_red, LONG new_green, LONG new_blue);
  934. Xvoid ConvertToIFF(char *file_name);
  935. Xint read_raw_byte(FILE *f);
  936. Xint read_raw_word(FILE *f);
  937. Xvoid read_raw_image (IMAGE *Image, char *filename);
  938. Xvoid dither (IMAGE *Image);
  939. X
  940. X/* Prototypes from palette.c */
  941. X
  942. Xvoid reset_colours (void);
  943. Xint closeness(int x, int y);
  944. Xvoid start_recording_colours (void);
  945. Xvoid record_colours (int new_red, int new_green, int new_blue);
  946. Xvoid choose_palette(void);
  947. Xint best_colour (int new_red, int new_blue, int new_green);
  948. X
  949. X/* Prototypes from showpriow.h */
  950. X
  951. Xstruct prioq_struct *pq_new (int index_size, int value_size);
  952. Xvoid pq_add (struct prioq *q, unsigned int index, unsigned int value);
  953. Xint pq_find_value (struct prioq *q, unsigned int value);
  954. Xvoid pq_balance(struct prioq *q, unsigned int entry_pos1);
  955. Xint pq_get_highest_index(struct prioq *q);
  956. Xint pq_get_highest_value(struct prioq *q);
  957. Xvoid pq_delete_highest (struct prioq *q);
  958. Xvoid pq_free (struct prioq *q);
  959. X
  960. END_OF_FILE
  961. if test 2971 -ne `wc -c <'src/dumproto.h'`; then
  962.     echo shar: \"'src/dumproto.h'\" unpacked with wrong size!
  963. fi
  964. # end of 'src/dumproto.h'
  965. fi
  966. if test -f 'src/dumptoiff.h' -a "${1}" != "-c" ; then 
  967.   echo shar: Will not clobber existing file \"'src/dumptoiff.h'\"
  968. else
  969. echo shar: Extracting \"'src/dumptoiff.h'\" \(2141 characters\)
  970. sed "s/^X//" >'src/dumptoiff.h' <<'END_OF_FILE'
  971. X/*****************************************************************************
  972. X*
  973. X*                                   dumptoiff.h
  974. X*
  975. X*   from DKBTrace (c) 1990  David Buck
  976. X*
  977. X*  This file contains types and constants for DumpToIFF
  978. X*
  979. X* This software is freely distributable. The source and/or object code may be
  980. X* copied or uploaded to communications services so long as this notice remains
  981. X* at the top of each file.  If any changes are made to the program, you must
  982. X* clearly indicate in the documentation and in the programs startup message
  983. X* who it was who made the changes. The documentation should also describe what
  984. X* those changes were. This software may not be included in whole or in
  985. X* part into any commercial package without the express written consent of the
  986. X* author.  It may, however, be included in other public domain or freely
  987. X* distributed software so long as the proper credit for the software is given.
  988. X*
  989. X* This software is provided as is without any guarantees or warranty. Although
  990. X* the author has attempted to find and correct any bugs in the software, he
  991. X* is not responsible for any damage caused by the use of the software.  The
  992. X* author is under no obligation to provide service, corrections, or upgrades
  993. X* to this package.
  994. X*
  995. X* Despite all the legal stuff above, if you do find bugs, I would like to hear
  996. X* about them.  Also, if you have any comments or questions, you may contact me
  997. X* at the following address:
  998. X*
  999. X*     David Buck
  1000. X*     22C Sonnet Cres.
  1001. X*     Nepean Ontario
  1002. X*     Canada, K2H 8W7
  1003. X*
  1004. X*  I can also be reached on the following bulleton boards:
  1005. X*
  1006. X*     ATX              (613) 526-4141
  1007. X*     OMX              (613) 731-3419
  1008. X*     Mystic           (613) 731-0088 or (613) 731-6698
  1009. X*
  1010. X*  Fidonet:   1:163/109.9
  1011. X*  Internet:  David_Buck@Carleton.CA
  1012. X*
  1013. X*
  1014. X*****************************************************************************/
  1015. X
  1016. X#define INT_REV 29L
  1017. X#define GR_REV 29L
  1018. X
  1019. X#define SCREEN_WIDTH 320L
  1020. X#define SCREEN_HEIGHT 400L
  1021. X#define BUFFER_SIZE 8096
  1022. X
  1023. Xstruct Image_Struct
  1024. X   {
  1025. X   int width, height;
  1026. X   unsigned char *red, *green, *blue;
  1027. X   };
  1028. Xtypedef struct Image_Struct IMAGE;
  1029. X
  1030. Xextern int Close_Threshold;
  1031. X
  1032. END_OF_FILE
  1033. if test 2141 -ne `wc -c <'src/dumptoiff.h'`; then
  1034.     echo shar: \"'src/dumptoiff.h'\" unpacked with wrong size!
  1035. fi
  1036. # end of 'src/dumptoiff.h'
  1037. fi
  1038. if test -f 'src/ibmconf.h' -a "${1}" != "-c" ; then 
  1039.   echo shar: Will not clobber existing file \"'src/ibmconf.h'\"
  1040. else
  1041. echo shar: Extracting \"'src/ibmconf.h'\" \(2761 characters\)
  1042. sed "s/^X//" >'src/ibmconf.h' <<'END_OF_FILE'
  1043. X/*****************************************************************************
  1044. X*
  1045. X*                                   ibmconf.h
  1046. X*
  1047. X*   from DKBTrace (c) 1990  David Buck
  1048. X*
  1049. X*  This file contains ibm-specific defines, types, etc.
  1050. X*
  1051. X* This software is freely distributable. The source and/or object code may be
  1052. X* copied or uploaded to communications services so long as this notice remains
  1053. X* at the top of each file.  If any changes are made to the program, you must
  1054. X* clearly indicate in the documentation and in the programs startup message
  1055. X* who it was who made the changes. The documentation should also describe what
  1056. X* those changes were. This software may not be included in whole or in
  1057. X* part into any commercial package without the express written consent of the
  1058. X* author.  It may, however, be included in other public domain or freely
  1059. X* distributed software so long as the proper credit for the software is given.
  1060. X*
  1061. X* This software is provided as is without any guarantees or warranty. Although
  1062. X* the author has attempted to find and correct any bugs in the software, he
  1063. X* is not responsible for any damage caused by the use of the software.  The
  1064. X* author is under no obligation to provide service, corrections, or upgrades
  1065. X* to this package.
  1066. X*
  1067. X* Despite all the legal stuff above, if you do find bugs, I would like to hear
  1068. X* about them.  Also, if you have any comments or questions, you may contact me
  1069. X* at the following address:
  1070. X*
  1071. X*     David Buck
  1072. X*     22C Sonnet Cres.
  1073. X*     Nepean Ontario
  1074. X*     Canada, K2H 8W7
  1075. X*
  1076. X*  I can also be reached on the following bulleton boards:
  1077. X*
  1078. X*     ATX              (613) 526-4141
  1079. X*     OMX              (613) 731-3419
  1080. X*     Mystic           (613) 731-0088 or (613) 731-6698
  1081. X*
  1082. X*  Fidonet:   1:163/109.9
  1083. X*  Internet:  David_Buck@Carleton.CA
  1084. X*
  1085. X*  IBM Port by Aaron A. Collins. Aaron may be reached on the following BBS'es:
  1086. X*
  1087. X*     Lattice BBS                      (708) 916-1200
  1088. X*     The Information Exchange BBS     (708) 945-5575
  1089. X*     Stillwaters BBS                  (708) 403-2826
  1090. X*
  1091. X*****************************************************************************/
  1092. X
  1093. X
  1094. X#include <conio.h>
  1095. X#include <stdarg.h>
  1096. X#include <stdlib.h>
  1097. X
  1098. X#ifndef TURBOC            /* Remove Present Definition */
  1099. X#define TURBOC TRUE        /* Un-Comment one set or the other... */
  1100. X#endif
  1101. X
  1102. X/* #define MATH_CO TRUE     * Feed this option through CC's comnd line! */
  1103. X
  1104. X#ifdef MATH_CO
  1105. X#define DBL long double
  1106. X#else
  1107. X#define DBL double
  1108. X#endif
  1109. X
  1110. X#ifdef MATH_CO
  1111. X#define DBL_FORMAT_STRING "%Lf"
  1112. X#else
  1113. X#define DBL_FORMAT_STRING "%lf"
  1114. X#endif
  1115. X
  1116. X#define TEST_ABORT if (Options & EXITENABLE) if (kbhit()) { Stop_Flag = TRUE; getch(); }
  1117. X
  1118. X/* This gives us ANSI prototyping */
  1119. X#define PARAMS(x) x
  1120. X
  1121. Xvoid far *farmalloc(unsigned long);
  1122. X#define malloc(size) farmalloc((unsigned long)size)
  1123. END_OF_FILE
  1124. if test 2761 -ne `wc -c <'src/ibmconf.h'`; then
  1125.     echo shar: \"'src/ibmconf.h'\" unpacked with wrong size!
  1126. fi
  1127. # end of 'src/ibmconf.h'
  1128. fi
  1129. if test -f 'src/packer.c' -a "${1}" != "-c" ; then 
  1130.   echo shar: Will not clobber existing file \"'src/packer.c'\"
  1131. else
  1132. echo shar: Extracting \"'src/packer.c'\" \(2762 characters\)
  1133. sed "s/^X//" >'src/packer.c' <<'END_OF_FILE'
  1134. X/*----------------------------------------------------------------------*
  1135. X * packer.c Convert data to "cmpByteRun1" run compression.     11/15/85
  1136. X *
  1137. X * By Jerry Morrison and Steve Shaw, Electronic Arts.
  1138. X * This software is in the public domain.
  1139. X *
  1140. X *    control bytes:
  1141. X *     [0..127]   : followed by n+1 bytes of data.
  1142. X *     [-1..-127] : followed by byte to be repeated (-n)+1 times.
  1143. X *     -128       : NOOP.
  1144. X *
  1145. X * This version for the Commodore-Amiga computer.
  1146. X *----------------------------------------------------------------------*/
  1147. X#include "iff/packer.h"
  1148. X
  1149. X#define DUMP    0
  1150. X#define RUN    1
  1151. X
  1152. X#define MinRun 3    
  1153. X#define MaxRun 128
  1154. X#define MaxDat 128
  1155. X
  1156. XLONG putSize;
  1157. X#define GetByte()    (*source++)
  1158. X#define PutByte(c)    { *dest++ = (c);   ++putSize; }
  1159. X
  1160. Xchar buf[256];    /* [TBD] should be 128?  on stack?*/
  1161. X
  1162. XBYTE *PutDump(dest, nn)  BYTE *dest;  int nn; {
  1163. X    int i;
  1164. X
  1165. X    PutByte(nn-1);
  1166. X    for(i = 0;  i < nn;  i++)   PutByte(buf[i]);
  1167. X    return(dest);
  1168. X    }
  1169. X
  1170. XBYTE *PutRun(dest, nn, cc)   BYTE *dest;  int nn, cc; {
  1171. X    PutByte(-(nn-1));
  1172. X    PutByte(cc);
  1173. X    return(dest);
  1174. X    }
  1175. X
  1176. X#define OutDump(nn)   dest = PutDump(dest, nn)
  1177. X#define OutRun(nn,cc) dest = PutRun(dest, nn, cc)
  1178. X
  1179. X/*----------- PackRow --------------------------------------------------*/
  1180. X/* Given POINTERS TO POINTERS, packs one row, updating the source and
  1181. X   destination pointers.  RETURNs count of packed bytes.*/
  1182. XLONG PackRow(pSource, pDest, rowSize)
  1183. X    BYTE **pSource, **pDest;   LONG rowSize; {
  1184. X    BYTE *source, *dest;
  1185. X    char c,lastc = '\0';
  1186. X    BOOL mode = DUMP;
  1187. X    short nbuf = 0;        /* number of chars in buffer */
  1188. X    short rstart = 0;        /* buffer index current run starts */
  1189. X
  1190. X    source = *pSource;
  1191. X    dest = *pDest;
  1192. X    putSize = 0;
  1193. X    buf[0] = lastc = c = GetByte();  /* so have valid lastc */
  1194. X    nbuf = 1;   rowSize--;    /* since one byte eaten.*/
  1195. X
  1196. X
  1197. X    for (;  rowSize;  --rowSize) {
  1198. X    buf[nbuf++] = c = GetByte();
  1199. X    switch (mode) {
  1200. X        case DUMP: 
  1201. X            /* If the buffer is full, write the length byte,
  1202. X               then the data */
  1203. X            if (nbuf>MaxDat) {
  1204. X                OutDump(nbuf-1);  
  1205. X                buf[0] = c; 
  1206. X                nbuf = 1;   rstart = 0; 
  1207. X                break;
  1208. X                }
  1209. X
  1210. X            if (c == lastc) {
  1211. X                if (nbuf-rstart >= MinRun) {
  1212. X                if (rstart > 0) OutDump(rstart);
  1213. X                mode = RUN;
  1214. X                }
  1215. X                else if (rstart == 0)
  1216. X                mode = RUN;    /* no dump in progress,
  1217. X                so can't lose by making these 2 a run.*/
  1218. X                }
  1219. X            else  rstart = nbuf-1;        /* first of run */ 
  1220. X            break;
  1221. X
  1222. X        case RUN: if ( (c != lastc)|| ( nbuf-rstart > MaxRun)) {
  1223. X                /* output run */
  1224. X               OutRun(nbuf-1-rstart,lastc);
  1225. X                buf[0] = c;
  1226. X                nbuf = 1; rstart = 0;
  1227. X                mode = DUMP;
  1228. X                }
  1229. X            break;
  1230. X        }
  1231. X
  1232. X    lastc = c;
  1233. X    }
  1234. X
  1235. X    switch (mode) {
  1236. X    case DUMP: OutDump(nbuf); break;
  1237. X    case RUN: OutRun(nbuf-rstart,lastc); break;
  1238. X    }
  1239. X    *pSource = source;
  1240. X    *pDest = dest;
  1241. X    return(putSize);
  1242. X    }
  1243. X
  1244. END_OF_FILE
  1245. if test 2762 -ne `wc -c <'src/packer.c'`; then
  1246.     echo shar: \"'src/packer.c'\" unpacked with wrong size!
  1247. fi
  1248. # end of 'src/packer.c'
  1249. fi
  1250. if test -f 'src/putpict.c' -a "${1}" != "-c" ; then 
  1251.   echo shar: Will not clobber existing file \"'src/putpict.c'\"
  1252. else
  1253. echo shar: Extracting \"'src/putpict.c'\" \(3712 characters\)
  1254. sed "s/^X//" >'src/putpict.c' <<'END_OF_FILE'
  1255. X/** putpict.c ***************************************************/
  1256. X/* PutPict().  Given a BitMap and a color map in RAM on the     */
  1257. X/* Amiga, outputs as an ILBM.  See /iff/ilbm.h & /iff/ilbmw.c.    */
  1258. X/*                   23-Jan-86                  */
  1259. X/*                                                              */
  1260. X/* By Jerry Morrison and Steve Shaw, Electronic Arts.           */
  1261. X/* This software is in the public domain.                       */
  1262. X/*                                                              */
  1263. X/* This version for the Commodore-Amiga computer.               */
  1264. X/*                                                              */
  1265. X/****************************************************************/
  1266. X#include "iff/intuall.h"
  1267. X#include "iff/gio.h"
  1268. X#include "iff/ilbm.h"
  1269. X#include "iff/putpict.h"
  1270. X
  1271. X#define MaxDepth 5
  1272. Xstatic IFFP ifferror = 0;
  1273. X
  1274. X#define CkErr(expression)  {if (ifferror == IFF_OKAY) ifferror = (expression);}
  1275. X    
  1276. X/*****************************************************************************/
  1277. X/* IffErr                                                                    */
  1278. X/*                                                                           */
  1279. X/* Returns the iff error code and resets it to zero                          */
  1280. X/*                                                                           */
  1281. X/*****************************************************************************/
  1282. XIFFP IffErr()
  1283. X   {
  1284. X   IFFP i;
  1285. X   i = ifferror;
  1286. X   ifferror = 0;
  1287. X   return(i);
  1288. X   }
  1289. X
  1290. X/*****************************************************************************/
  1291. X/* PutPict()                                                                 */
  1292. X/*                                                                           */
  1293. X/* Put a picture into an IFF file                                            */
  1294. X/* Pass in mask == NULL for no mask.                                         */
  1295. X/*                                                                           */
  1296. X/* Buffer should be big enough for one packed scan line                      */
  1297. X/* Buffer used as temporary storage to speed-up writing.                     */
  1298. X/* A large buffer, say 8KB, is useful for minimizing Write and Seek calls.   */
  1299. X/* (See /iff/gio.h & /iff/gio.c).                                            */
  1300. X/*****************************************************************************/
  1301. X    
  1302. XBOOL PutPict(file, vp, buffer, bufsize)
  1303. X    LONG file;
  1304. X    struct ViewPort *vp;
  1305. X    BYTE *buffer;
  1306. X    LONG bufsize;
  1307. X    {
  1308. X    int pageW, pageH;
  1309. X    BitMapHeader bmHdr;
  1310. X    GroupContext fileContext, formContext;
  1311. X
  1312. X    pageW = vp->DWidth;
  1313. X    pageH = vp->DHeight;
  1314. X
  1315. X    ifferror = InitBMHdr(&bmHdr,
  1316. X    vp->RasInfo->BitMap, 
  1317. X    mskNone, 
  1318. X    cmpByteRun1,
  1319. X    0,
  1320. X    pageW, 
  1321. X    pageH );
  1322. X    
  1323. X/* use buffered write for speedup, if it is big-enough for both
  1324. X * PutBODY's buffer and a gio buffer.*/
  1325. X#define BODY_BUFSIZE 512
  1326. X    if (ifferror == IFF_OKAY  &&  bufsize > 2*BODY_BUFSIZE) {
  1327. X    if (GWriteDeclare(file, buffer+BODY_BUFSIZE, bufsize-BODY_BUFSIZE) < 0)
  1328. X        ifferror = DOS_ERROR;
  1329. X    bufsize = BODY_BUFSIZE;
  1330. X    }
  1331. X    
  1332. X    CkErr(OpenWIFF(file, &fileContext, szNotYetKnown) );
  1333. X    CkErr(StartWGroup(&fileContext, FORM, szNotYetKnown, ID_ILBM, &formContext) );
  1334. X
  1335. X    CkErr(PutCk(&formContext, ID_BMHD, sizeof(BitMapHeader), (BYTE *)&bmHdr));
  1336. X
  1337. X    CkErr(PutCAMG(&formContext, vp->Modes));
  1338. X
  1339. X    if (vp->ColorMap != NULL)
  1340. X    CkErr( PutCMAP(&formContext, vp));
  1341. X    CkErr( PutBODY(&formContext, vp->RasInfo->BitMap, NULL, &bmHdr, buffer, bufsize) );
  1342. X
  1343. X    CkErr( EndWGroup(&formContext) );
  1344. X    CkErr( CloseWGroup(&fileContext) );
  1345. X    if (GWriteUndeclare(file) < 0  &&  ifferror == IFF_OKAY)
  1346. X    ifferror = DOS_ERROR;
  1347. X    return( (BOOL)(ifferror != IFF_OKAY) );
  1348. X    }    
  1349. X
  1350. END_OF_FILE
  1351. if test 3712 -ne `wc -c <'src/putpict.c'`; then
  1352.     echo shar: \"'src/putpict.c'\" unpacked with wrong size!
  1353. fi
  1354. # end of 'src/putpict.c'
  1355. fi
  1356. if test -f 'src/ray.c' -a "${1}" != "-c" ; then 
  1357.   echo shar: Will not clobber existing file \"'src/ray.c'\"
  1358. else
  1359. echo shar: Extracting \"'src/ray.c'\" \(4069 characters\)
  1360. sed "s/^X//" >'src/ray.c' <<'END_OF_FILE'
  1361. X/*****************************************************************************
  1362. X*
  1363. X*                                      ray.c
  1364. X*
  1365. X*   from DKBTrace (c) 1990  David Buck
  1366. X*
  1367. X*  This module implements functions pertaining to rays.
  1368. X*
  1369. X* This software is freely distributable. The source and/or object code may be
  1370. X* copied or uploaded to communications services so long as this notice remains
  1371. X* at the top of each file.  If any changes are made to the program, you must
  1372. X* clearly indicate in the documentation and in the programs startup message
  1373. X* who it was who made the changes. The documentation should also describe what
  1374. X* those changes were. This software may not be included in whole or in
  1375. X* part into any commercial package without the express written consent of the
  1376. X* author.  It may, however, be included in other public domain or freely
  1377. X* distributed software so long as the proper credit for the software is given.
  1378. X*
  1379. X* This software is provided as is without any guarantees or warranty. Although
  1380. X* the author has attempted to find and correct any bugs in the software, he
  1381. X* is not responsible for any damage caused by the use of the software.  The
  1382. X* author is under no obligation to provide service, corrections, or upgrades
  1383. X* to this package.
  1384. X*
  1385. X* Despite all the legal stuff above, if you do find bugs, I would like to hear
  1386. X* about them.  Also, if you have any comments or questions, you may contact me
  1387. X* at the following address:
  1388. X*
  1389. X*     David Buck
  1390. X*     22C Sonnet Cres.
  1391. X*     Nepean Ontario
  1392. X*     Canada, K2H 8W7
  1393. X*
  1394. X*  I can also be reached on the following bulleton boards:
  1395. X*
  1396. X*     ATX              (613) 526-4141
  1397. X*     OMX              (613) 731-3419
  1398. X*     Mystic           (613) 731-0088 or (613) 731-6698
  1399. X*
  1400. X*  Fidonet:   1:163/109.9
  1401. X*  Internet:  David_Buck@Carleton.CA
  1402. X*
  1403. X*  IBM Port by Aaron A. Collins. Aaron may be reached on the following BBS'es:
  1404. X*
  1405. X*     Lattice BBS                      (708) 916-1200
  1406. X*     The Information Exchange BBS     (708) 945-5575
  1407. X*     Stillwaters BBS                  (708) 403-2826
  1408. X*
  1409. X*****************************************************************************/
  1410. X
  1411. X
  1412. X
  1413. X#include "frame.h"
  1414. X#include "vector.h"
  1415. X#include "dkbproto.h"
  1416. X
  1417. X#define Mix(a,b,c) { \
  1418. X   (a).x = (b).x * (c).y; \
  1419. X   (a).y = (b).x * (c).z; \
  1420. X   (a).z = (b).y * (c).z; }
  1421. X
  1422. Xvoid Make_Ray(r)
  1423. X   RAY *r;
  1424. X   {
  1425. X   VECTOR Temp_Init_Dir;
  1426. X
  1427. X   VSquareTerms (r -> Initial_2, r -> Initial);
  1428. X   VSquareTerms (r -> Direction_2, r -> Direction);
  1429. X   VEvaluate (r -> Initial_Direction, r -> Initial, r -> Direction);
  1430. X   Mix (r -> Mixed_Initial_Initial, r -> Initial, r -> Initial);
  1431. X   Mix (r -> Mixed_Dir_Dir, r -> Direction, r -> Direction);
  1432. X   Mix (Temp_Init_Dir, r -> Initial, r -> Direction);
  1433. X   Mix (r -> Mixed_Init_Dir, r -> Direction, r -> Initial);
  1434. X   VAdd (r -> Mixed_Init_Dir, r -> Mixed_Init_Dir, Temp_Init_Dir);
  1435. X   r -> Quadric_Constants_Cached = TRUE;
  1436. X   }
  1437. X
  1438. Xvoid Initialize_Ray_Containers (Ray)
  1439. X   RAY *Ray;
  1440. X   {
  1441. X   Ray -> Containing_Index = -1;
  1442. X   }
  1443. X
  1444. Xvoid Copy_Ray_Containers (Dest_Ray, Source_Ray)
  1445. X   RAY *Dest_Ray, *Source_Ray;
  1446. X   {
  1447. X   register int i;
  1448. X   
  1449. X   if ((Dest_Ray -> Containing_Index = Source_Ray -> Containing_Index)
  1450. X         >= MAX_CONTAINING_OBJECTS) {
  1451. X      printf ("ERROR - Containing Index too high\n");
  1452. X      close_all();
  1453. X      exit (0);
  1454. X      }
  1455. X
  1456. X   for (i = 0 ; i < MAX_CONTAINING_OBJECTS ; i++) {
  1457. X      Dest_Ray -> Containing_Objects[i] = Source_Ray -> Containing_Objects[i];
  1458. X      Dest_Ray -> Containing_IORs[i] = Source_Ray -> Containing_IORs[i];
  1459. X      }
  1460. X   }
  1461. X
  1462. Xvoid Ray_Enter (ray, object)
  1463. X   RAY *ray;
  1464. X   OBJECT *object;
  1465. X   {
  1466. X   register int index;
  1467. X
  1468. X   if ((index = ++(ray -> Containing_Index)) >= MAX_CONTAINING_OBJECTS) {
  1469. X      printf ("Too many nested refracting objects\n");
  1470. X      close_all();
  1471. X      exit(0);
  1472. X      }
  1473. X
  1474. X   ray -> Containing_Objects [index] = object;
  1475. X   ray -> Containing_IORs [index] = object->Object_Texture->Object_Index_Of_Refraction;
  1476. X   }
  1477. X
  1478. Xvoid Ray_Exit (ray)
  1479. X   RAY *ray;
  1480. X   {
  1481. X   if (--(ray -> Containing_Index) < -1) {
  1482. X      printf ("Too many exits from refractions\n");
  1483. X      close_all();
  1484. X      exit(0);
  1485. X      }
  1486. X   }
  1487. END_OF_FILE
  1488. if test 4069 -ne `wc -c <'src/ray.c'`; then
  1489.     echo shar: \"'src/ray.c'\" unpacked with wrong size!
  1490. fi
  1491. # end of 'src/ray.c'
  1492. fi
  1493. if test -f 'src/read.me' -a "${1}" != "-c" ; then 
  1494.   echo shar: Will not clobber existing file \"'src/read.me'\"
  1495. else
  1496. echo shar: Extracting \"'src/read.me'\" \(3796 characters\)
  1497. sed "s/^X//" >'src/read.me' <<'END_OF_FILE'
  1498. X
  1499. X                                DKBTrace
  1500. X
  1501. X
  1502. X
  1503. X
  1504. X   This ray tracer was written by David K. Buck and is released as freely
  1505. X   distributable software.  The author retains all copyrights but permits
  1506. X   free distribution of the software through any medium.  The software may
  1507. X   be used without charge so long as the code is not included in any 
  1508. X   commercial product.
  1509. X
  1510. X
  1511. X   The Amiga archive here contains two versions of the raytracer:
  1512. X
  1513. X       traceffp   - Fast Floating Point version of the raytracer.
  1514. X                    This version will run on any Amiga with sufficient
  1515. X                    memory.
  1516. X
  1517. X       trace881   - Math coprocessor version.  This version will only
  1518. X                    run on 68020 or 68030 based systems that have a
  1519. X                    68881 or 68882 math coprocessor.
  1520. X
  1521. X
  1522. X   I usually like having a fairly large stack for this program.  If it
  1523. X   crashes on you, try inceasing the stack size.
  1524. X
  1525. X
  1526. X   In addition, the following utilities are provided (these will run on any
  1527. X   AMIGA system).
  1528. X
  1529. X       DumpToIFF  - Converts the raw 24 bit output files of the raytracer into
  1530. X                    hires HAM images.
  1531. X               syntax:
  1532. X                DumpToIFF  [options] input-file [output-file [palette-file]] 
  1533. X
  1534. X               options are:
  1535. X                    -d            Suppress Floyd Steinberg dithering
  1536. X                    -pfilename    Output a colour palette for the picture
  1537. X
  1538. X              The colour palette for one image may be used in other images.
  1539. X              This is useful for animations in order to force the entire
  1540. X              animation to use the same colour palette.
  1541. X
  1542. X                 eg.
  1543. X                   DumpToIFF  -pmyImage.palette myImage.dis  myImage.ham
  1544. X                   DumpToIFF  myImage2.dis  myImage2.ham  myImage.palette
  1545. X
  1546. X
  1547. X       Dump2RGB   - Converts the raw 24 bit output files of the raytracer into
  1548. X                    three separate dump files for red, green and blue.
  1549. X               syntax:
  1550. X                Dump2RGB [options] input-file
  1551. X
  1552. X               options are:
  1553. X                    -wxxx         Output image width
  1554. X                    -hxxx         Output image height
  1555. X
  1556. X       Dump2Raw    - Same as Dump2RGB but takes the size from the input file
  1557. X                     and takes less memory.
  1558. X       Sculpt2DKB  - Converts a Sculpt-Animate 3D .scene file into DKB format.
  1559. X              At the current time, smoothed triangles are not supported.  The
  1560. X              only information converted is the information on the polygons,
  1561. X              the colours, and the textures.  Lightsources, viewpoints, and
  1562. X              world information is currently ignored.
  1563. X
  1564. X                syntax:
  1565. X                   Sculpt2DKB  scene-file  dkb-dat-file
  1566. X
  1567. X              You must edit this file after the conversion to add a viewpoint
  1568. X              and lightsources as needed.
  1569. X
  1570. X
  1571. X   The program documentation can be found in the file DKB.DOC and the
  1572. X   documentation for some Amiga specific utilities may be found in
  1573. X   AmigaUtils.doc.
  1574. X
  1575. X   This program is being distributed in four separate packages:
  1576. X
  1577. X
  1578. X      DKBTrace.lzh:  Executables for traceffp and trace881
  1579. X                     documentation files
  1580. X                     DumpToIFF and Sculpt2DKB executables
  1581. X
  1582. X      DKBData.lzh    Many sample data files
  1583. X
  1584. X      DKBSource.lzh  Source code for DKBTrace, Amiga utilities, and
  1585. X                     IBM Utilities.
  1586. X
  1587. X
  1588. X      DKBPics.lzh    Sample pictures produced by the raytracer.
  1589. X                     (you could render these yourself using the
  1590. X                      data files in the DKBTrace.lzh archive)
  1591. X
  1592. X
  1593. X   There is a document in the DKBTrace.lzh archive which describes the
  1594. X   conversions required to use data files for DKBTrace version 1.2 with
  1595. X   the new 2.0 version.  This file is called 12to20.doc
  1596. X
  1597. X   This readme file is in all three archives.
  1598. END_OF_FILE
  1599. if test 3796 -ne `wc -c <'src/read.me'`; then
  1600.     echo shar: \"'src/read.me'\" unpacked with wrong size!
  1601. fi
  1602. # end of 'src/read.me'
  1603. fi
  1604. if test -f 'src/showprioq.h' -a "${1}" != "-c" ; then 
  1605.   echo shar: Will not clobber existing file \"'src/showprioq.h'\"
  1606. else
  1607. echo shar: Extracting \"'src/showprioq.h'\" \(2050 characters\)
  1608. sed "s/^X//" >'src/showprioq.h' <<'END_OF_FILE'
  1609. X/*****************************************************************************
  1610. X*
  1611. X*                                   showprioq.h
  1612. X*
  1613. X*   from DKBTrace (c) 1990  David Buck
  1614. X*
  1615. X*  This file contains types and constants for showprioq
  1616. X*
  1617. X* This software is freely distributable. The source and/or object code may be
  1618. X* copied or uploaded to communications services so long as this notice remains
  1619. X* at the top of each file.  If any changes are made to the program, you must
  1620. X* clearly indicate in the documentation and in the programs startup message
  1621. X* who it was who made the changes. The documentation should also describe what
  1622. X* those changes were. This software may not be included in whole or in
  1623. X* part into any commercial package without the express written consent of the
  1624. X* author.  It may, however, be included in other public domain or freely
  1625. X* distributed software so long as the proper credit for the software is given.
  1626. X*
  1627. X* This software is provided as is without any guarantees or warranty. Although
  1628. X* the author has attempted to find and correct any bugs in the software, he
  1629. X* is not responsible for any damage caused by the use of the software.  The
  1630. X* author is under no obligation to provide service, corrections, or upgrades
  1631. X* to this package.
  1632. X*
  1633. X* Despite all the legal stuff above, if you do find bugs, I would like to hear
  1634. X* about them.  Also, if you have any comments or questions, you may contact me
  1635. X* at the following address:
  1636. X*
  1637. X*     David Buck
  1638. X*     22C Sonnet Cres.
  1639. X*     Nepean Ontario
  1640. X*     Canada, K2H 8W7
  1641. X*
  1642. X*  I can also be reached on the following bulleton boards:
  1643. X*
  1644. X*     ATX              (613) 526-4141
  1645. X*     OMX              (613) 731-3419
  1646. X*     Mystic           (613) 731-0088 or (613) 731-6698
  1647. X*
  1648. X*  Fidonet:   1:163/109.9
  1649. X*  Internet:  David_Buck@Carleton.CA
  1650. X*
  1651. X*
  1652. X*****************************************************************************/
  1653. X
  1654. Xstruct q_entry {
  1655. X  short index;
  1656. X  short value;
  1657. X  };
  1658. X
  1659. Xstruct prioq_struct {
  1660. X  struct q_entry *queue;
  1661. X  unsigned char *array;
  1662. X  unsigned int current_entry, queue_size, array_size;
  1663. X  };
  1664. X
  1665. END_OF_FILE
  1666. if test 2050 -ne `wc -c <'src/showprioq.h'`; then
  1667.     echo shar: \"'src/showprioq.h'\" unpacked with wrong size!
  1668. fi
  1669. # end of 'src/showprioq.h'
  1670. fi
  1671. if test -f 'src/unix.c' -a "${1}" != "-c" ; then 
  1672.   echo shar: Will not clobber existing file \"'src/unix.c'\"
  1673. else
  1674. echo shar: Extracting \"'src/unix.c'\" \(194 characters\)
  1675. sed "s/^X//" >'src/unix.c' <<'END_OF_FILE'
  1676. Xvoid display_finished ()
  1677. X   {
  1678. X   }
  1679. X
  1680. Xvoid display_init ()
  1681. X   {
  1682. X   }
  1683. X
  1684. Xvoid display_close ()
  1685. X   {
  1686. X   }
  1687. X
  1688. Xvoid display_plot (x, y, Red, Green, Blue)
  1689. X   int x, y;
  1690. X   char Red, Green, Blue;
  1691. X   {
  1692. X   }
  1693. X
  1694. END_OF_FILE
  1695. if test 194 -ne `wc -c <'src/unix.c'`; then
  1696.     echo shar: \"'src/unix.c'\" unpacked with wrong size!
  1697. fi
  1698. # end of 'src/unix.c'
  1699. fi
  1700. if test -f 'src/unixconf.h' -a "${1}" != "-c" ; then 
  1701.   echo shar: Will not clobber existing file \"'src/unixconf.h'\"
  1702. else
  1703. echo shar: Extracting \"'src/unixconf.h'\" \(2218 characters\)
  1704. sed "s/^X//" >'src/unixconf.h' <<'END_OF_FILE'
  1705. X/*****************************************************************************
  1706. X*
  1707. X*                                     unixconf.h
  1708. X*
  1709. X*   from DKBTrace (c) 1990  David Buck
  1710. X*
  1711. X*  This header file contains all constants and types required to run on a
  1712. X*  UNIX system.
  1713. X*
  1714. X* This software is freely distributable. The source and/or object code may be
  1715. X* copied or uploaded to communications services so long as this notice remains
  1716. X* at the top of each file.  If any changes are made to the program, you must
  1717. X* clearly indicate in the documentation and in the programs startup message
  1718. X* who it was who made the changes. The documentation should also describe what
  1719. X* those changes were. This software may not be included in whole or in
  1720. X* part into any commercial package without the express written consent of the
  1721. X* author.  It may, however, be included in other public domain or freely
  1722. X* distributed software so long as the proper credit for the software is given.
  1723. X*
  1724. X* This software is provided as is without any guarantees or warranty. Although
  1725. X* the author has attempted to find and correct any bugs in the software, he
  1726. X* is not responsible for any damage caused by the use of the software.  The
  1727. X* author is under no obligation to provide service, corrections, or upgrades
  1728. X* to this package.
  1729. X*
  1730. X* Despite all the legal stuff above, if you do find bugs, I would like to hear
  1731. X* about them.  Also, if you have any comments or questions, you may contact me
  1732. X* at the following address:
  1733. X*
  1734. X*     David Buck
  1735. X*     22C Sonnet Cres.
  1736. X*     Nepean Ontario
  1737. X*     Canada, K2H 8W7
  1738. X*
  1739. X*  I can also be reached on the following bulleton boards:
  1740. X*
  1741. X*     ATX              (613) 526-4141
  1742. X*     OMX              (613) 731-3419
  1743. X*     Mystic           (613) 731-0088 or (613) 731-6698
  1744. X*
  1745. X*  Fidonet:   1:163/109.9
  1746. X*  Internet:  David_Buck@Carleton.CA
  1747. X*
  1748. X*  IBM Port by Aaron A. Collins. Aaron may be reached on the following BBS'es:
  1749. X*
  1750. X*     Lattice BBS                      (708) 916-1200
  1751. X*     The Information Exchange BBS     (708) 945-5575
  1752. X*     Stillwaters BBS                  (708) 403-2826
  1753. X*
  1754. X*****************************************************************************/
  1755. X
  1756. X/* By default, UNIX doesn't use ANSI prototyping */
  1757. X
  1758. X#define PARAMS(x) ()
  1759. END_OF_FILE
  1760. if test 2218 -ne `wc -c <'src/unixconf.h'`; then
  1761.     echo shar: \"'src/unixconf.h'\" unpacked with wrong size!
  1762. fi
  1763. # end of 'src/unixconf.h'
  1764. fi
  1765. if test -f 'src/vector.h' -a "${1}" != "-c" ; then 
  1766.   echo shar: Will not clobber existing file \"'src/vector.h'\"
  1767. else
  1768. echo shar: Extracting \"'src/vector.h'\" \(3987 characters\)
  1769. sed "s/^X//" >'src/vector.h' <<'END_OF_FILE'
  1770. X/*****************************************************************************
  1771. X*
  1772. X*                                    vector.h
  1773. X*
  1774. X*   from DKBTrace (c) 1990  David Buck
  1775. X*
  1776. X*  This module contains macros to perform operations on vectors.
  1777. X*
  1778. X* This software is freely distributable. The source and/or object code may be
  1779. X* copied or uploaded to communications services so long as this notice remains
  1780. X* at the top of each file.  If any changes are made to the program, you must
  1781. X* clearly indicate in the documentation and in the programs startup message
  1782. X* who it was who made the changes. The documentation should also describe what
  1783. X* those changes were. This software may not be included in whole or in
  1784. X* part into any commercial package without the express written consent of the
  1785. X* author.  It may, however, be included in other public domain or freely
  1786. X* distributed software so long as the proper credit for the software is given.
  1787. X*
  1788. X* This software is provided as is without any guarantees or warranty. Although
  1789. X* the author has attempted to find and correct any bugs in the software, he
  1790. X* is not responsible for any damage caused by the use of the software.  The
  1791. X* author is under no obligation to provide service, corrections, or upgrades
  1792. X* to this package.
  1793. X*
  1794. X* Despite all the legal stuff above, if you do find bugs, I would like to hear
  1795. X* about them.  Also, if you have any comments or questions, you may contact me
  1796. X* at the following address:
  1797. X*
  1798. X*     David Buck
  1799. X*     22C Sonnet Cres.
  1800. X*     Nepean Ontario
  1801. X*     Canada, K2H 8W7
  1802. X*
  1803. X*  I can also be reached on the following bulleton boards:
  1804. X*
  1805. X*     ATX              (613) 526-4141
  1806. X*     OMX              (613) 731-3419
  1807. X*     Mystic           (613) 731-0088 or (613) 731-6698
  1808. X*
  1809. X*  Fidonet:   1:163/109.9
  1810. X*  Internet:  David_Buck@Carleton.CA
  1811. X*
  1812. X*  IBM Port by Aaron A. Collins. Aaron may be reached on the following BBS'es:
  1813. X*
  1814. X*     Lattice BBS                      (708) 916-1200
  1815. X*     The Information Exchange BBS     (708) 945-5575
  1816. X*     Stillwaters BBS                  (708) 403-2826
  1817. X*
  1818. X*****************************************************************************/
  1819. X
  1820. X
  1821. X/* Misc. Vector Math Macro Definitions */
  1822. X
  1823. Xextern DBL VTemp;
  1824. X
  1825. X/* Vector Add */
  1826. X#define VAdd(a, b, c) {(a).x=(b).x+(c).x;(a).y=(b).y+(c).y;(a).z=(b).z+(c).z;}
  1827. X
  1828. X/* Vector Subtract */
  1829. X#define VSub(a, b, c) {(a).x=(b).x-(c).x;(a).y=(b).y-(c).y;(a).z=(b).z-(c).z;}
  1830. X
  1831. X/* Scale - Multiply Vector by a Scalar */
  1832. X#define VScale(a, b, k) {(a).x=(b).x*(k);(a).y=(b).y*(k);(a).z=(b).z*(k);}
  1833. X
  1834. X/* Inverse Scale - Divide Vector by a Scalar */
  1835. X#define VInverseScale(a, b, k) {(a).x=(b).x/(k);(a).y=(b).y/(k);(a).z=(b).z/(k);}
  1836. X
  1837. X/* Dot Product - Gives Scalar angle (a) between two vectors (b) and (c) */
  1838. X#define VDot(a, b, c) {a=(b).x*(c).x+(b).y*(c).y+(b).z*(c).z;}
  1839. X
  1840. X/* Cross Product - returns Vector (a) = (b) x (c) 
  1841. X   WARNING:  a must be different from b and c.*/
  1842. X#define VCross(a,b,c) {(a).x=(b).y*(c).z-(b).z*(c).y; \
  1843. X                       (a).y=(b).z*(c).x-(b).x*(c).z; \
  1844. X                       (a).z=(b).x*(c).y-(b).y*(c).x;}
  1845. X
  1846. X/* Evaluate - returns Vector (a) = Multiply Vector (b) by Vector (c) */
  1847. X#define VEvaluate(a, b, c) {(a).x=(b).x*(c).x;(a).y=(b).y*(c).y;(a).z=(b).z*(c).z;}
  1848. X
  1849. X/* Square a Vector */
  1850. X#define    VSqr(a) {(a).x*(a).x;(a).y*(a).y;(a).z*(a).z;}
  1851. X
  1852. X/* Simple Scalar Square Macro */
  1853. X#define    Sqr(a)    (a*a)
  1854. X
  1855. X/* Square a Vector (b) and Assign to another Vector (a) */
  1856. X#define VSquareTerms(a, b) {(a).x=(b).x*(b).x;(a).y=(b).y*(b).y;(a).z=(b).z*(b).z;}
  1857. X
  1858. X/* Vector Length - returs Scalar Euclidean Length (a) of Vector (b) */
  1859. X#define VLength(a, b) {a=sqrt((b).x*(b).x+(b).y*(b).y+(b).z*(b).z);}
  1860. X
  1861. X/* Normalize a Vector - returns a vector (length of 1) that points at (b) */
  1862. X#define VNormalize(a,b) {VTemp=sqrt((b).x*(b).x+(b).y*(b).y+(b).z*(b).z);(a).x=(b).x/VTemp;(a).y=(b).y/VTemp;(a).z=(b).z/VTemp;}
  1863. X
  1864. X/* Compute a Vector (a) Halfway Between Two Given Vectors (b) and (c) */
  1865. X#define VHalf(a, b, c) {(a).x=0.5*((b).x+(c).x);(a).y=0.5*((b).y+(c).y);(a).z=0.5*((b).z+(c).z);}
  1866. END_OF_FILE
  1867. if test 3987 -ne `wc -c <'src/vector.h'`; then
  1868.     echo shar: \"'src/vector.h'\" unpacked with wrong size!
  1869. fi
  1870. # end of 'src/vector.h'
  1871. fi
  1872. if test -f 'src/viewpnt.c' -a "${1}" != "-c" ; then 
  1873.   echo shar: Will not clobber existing file \"'src/viewpnt.c'\"
  1874. else
  1875. echo shar: Extracting \"'src/viewpnt.c'\" \(4251 characters\)
  1876. sed "s/^X//" >'src/viewpnt.c' <<'END_OF_FILE'
  1877. X/*****************************************************************************
  1878. X*
  1879. X*                                     viewpnt.c
  1880. X*
  1881. X*   from DKBTrace (c) 1990  David Buck
  1882. X*
  1883. X*  This module implements methods for managing the viewpoint.
  1884. X*
  1885. X* This software is freely distributable. The source and/or object code may be
  1886. X* copied or uploaded to communications services so long as this notice remains
  1887. X* at the top of each file.  If any changes are made to the program, you must
  1888. X* clearly indicate in the documentation and in the programs startup message
  1889. X* who it was who made the changes. The documentation should also describe what
  1890. X* those changes were. This software may not be included in whole or in
  1891. X* part into any commercial package without the express written consent of the
  1892. X* author.  It may, however, be included in other public domain or freely
  1893. X* distributed software so long as the proper credit for the software is given.
  1894. X*
  1895. X* This software is provided as is without any guarantees or warranty. Although
  1896. X* the author has attempted to find and correct any bugs in the software, he
  1897. X* is not responsible for any damage caused by the use of the software.  The
  1898. X* author is under no obligation to provide service, corrections, or upgrades
  1899. X* to this package.
  1900. X*
  1901. X* Despite all the legal stuff above, if you do find bugs, I would like to hear
  1902. X* about them.  Also, if you have any comments or questions, you may contact me
  1903. X* at the following address:
  1904. X*
  1905. X*     David Buck
  1906. X*     22C Sonnet Cres.
  1907. X*     Nepean Ontario
  1908. X*     Canada, K2H 8W7
  1909. X*
  1910. X*  I can also be reached on the following bulleton boards:
  1911. X*
  1912. X*     ATX              (613) 526-4141
  1913. X*     OMX              (613) 731-3419
  1914. X*     Mystic           (613) 731-0088 or (613) 731-6698
  1915. X*
  1916. X*  Fidonet:   1:163/109.9
  1917. X*  Internet:  David_Buck@Carleton.CA
  1918. X*
  1919. X*  IBM Port by Aaron A. Collins. Aaron may be reached on the following BBS'es:
  1920. X*
  1921. X*     Lattice BBS                      (708) 916-1200
  1922. X*     The Information Exchange BBS     (708) 945-5575
  1923. X*     Stillwaters BBS                  (708) 403-2826
  1924. X*
  1925. X*****************************************************************************/
  1926. X
  1927. X#include "frame.h"
  1928. X#include "vector.h"
  1929. X#include "dkbproto.h"
  1930. X
  1931. XMETHODS Viewpoint_Methods =
  1932. X   { NULL, NULL, NULL, NULL, Copy_Viewpoint,
  1933. X     Translate_Viewpoint, Rotate_Viewpoint,
  1934. X     Scale_Viewpoint, NULL};
  1935. X
  1936. Xvoid *Copy_Viewpoint (Object)
  1937. X   OBJECT *Object;
  1938. X   {
  1939. X   VIEWPOINT *Viewpoint = (VIEWPOINT *) Object;
  1940. X   VIEWPOINT *New_Viewpoint;
  1941. X
  1942. X   New_Viewpoint = Get_Viewpoint();
  1943. X
  1944. X   New_Viewpoint -> Location = Viewpoint -> Location;
  1945. X   New_Viewpoint -> Direction = Viewpoint -> Direction;
  1946. X   New_Viewpoint -> Right = Viewpoint -> Right;
  1947. X   New_Viewpoint -> Up = Viewpoint -> Up;
  1948. X   return (New_Viewpoint);
  1949. X   }
  1950. X
  1951. Xvoid Translate_Viewpoint (Object, Vector)
  1952. X   OBJECT *Object;
  1953. X   VECTOR *Vector;
  1954. X   {
  1955. X   VAdd (((VIEWPOINT *) Object) -> Location, 
  1956. X         ((VIEWPOINT *) Object) -> Location,
  1957. X         *Vector);
  1958. X   }
  1959. X
  1960. Xvoid Rotate_Viewpoint (Object, Vector)
  1961. X   OBJECT *Object;
  1962. X   VECTOR *Vector;
  1963. X   {
  1964. X   TRANSFORMATION Transformation;
  1965. X   VIEWPOINT *Viewpoint = (VIEWPOINT *) Object;
  1966. X
  1967. X   Get_Rotation_Transformation(&Transformation, Vector);
  1968. X   MTransformVector (&(Viewpoint -> Location),
  1969. X                     &(Viewpoint -> Location), &Transformation);
  1970. X
  1971. X   MTransformVector (&(Viewpoint -> Direction),
  1972. X                     &(Viewpoint -> Direction), &Transformation);
  1973. X
  1974. X   MTransformVector (&(Viewpoint -> Up),
  1975. X                     &(Viewpoint -> Up), &Transformation);
  1976. X
  1977. X   MTransformVector (&(Viewpoint -> Right),
  1978. X                     &(Viewpoint -> Right), &Transformation);
  1979. X   }
  1980. X
  1981. Xvoid Scale_Viewpoint (Object, Vector)
  1982. X   OBJECT *Object;
  1983. X   VECTOR *Vector;
  1984. X   {
  1985. X   TRANSFORMATION Transformation;
  1986. X   VIEWPOINT *Viewpoint = (VIEWPOINT *) Object;
  1987. X
  1988. X   Get_Scaling_Transformation(&Transformation, Vector);
  1989. X   MTransformVector (&(Viewpoint -> Location),
  1990. X                     &(Viewpoint -> Location), &Transformation);
  1991. X
  1992. X   MTransformVector (&(Viewpoint -> Direction),
  1993. X                     &(Viewpoint -> Direction), &Transformation);
  1994. X
  1995. X   MTransformVector (&(Viewpoint -> Up),
  1996. X                     &(Viewpoint -> Up), &Transformation);
  1997. X
  1998. X   MTransformVector (&(Viewpoint -> Right),
  1999. X                     &(Viewpoint -> Right), &Transformation);
  2000. X   }
  2001. X
  2002. END_OF_FILE
  2003. if test 4251 -ne `wc -c <'src/viewpnt.c'`; then
  2004.     echo shar: \"'src/viewpnt.c'\" unpacked with wrong size!
  2005. fi
  2006. # end of 'src/viewpnt.c'
  2007. fi
  2008. if test -f 'src/withfile' -a "${1}" != "-c" ; then 
  2009.   echo shar: Will not clobber existing file \"'src/withfile'\"
  2010. else
  2011. echo shar: Extracting \"'src/withfile'\" \(277 characters\)
  2012. sed "s/^X//" >'src/withfile' <<'END_OF_FILE'
  2013. XFROM
  2014. X   lib:c.o
  2015. X   trace.o
  2016. X   render.o
  2017. X   tokenize.o
  2018. X   parse.o
  2019. X   objects.o
  2020. X   quadrics.o
  2021. X   spheres.o
  2022. X   planes.o
  2023. X   triangle.o
  2024. X   lighting.o
  2025. X   prioq.o
  2026. X   texture.o
  2027. X   matrices.o
  2028. X   csg.o
  2029. X   colour.o
  2030. X   viewpnt.o
  2031. X   ray.o
  2032. X   iff.o
  2033. X   gif.o
  2034. X   gifdecod.o
  2035. X   raw.o
  2036. X   amiga.o
  2037. END_OF_FILE
  2038. if test 277 -ne `wc -c <'src/withfile'`; then
  2039.     echo shar: \"'src/withfile'\" unpacked with wrong size!
  2040. fi
  2041. # end of 'src/withfile'
  2042. fi
  2043. echo shar: End of archive 1 \(of 10\).
  2044. cp /dev/null ark1isdone
  2045. MISSING=""
  2046. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  2047.     if test ! -f ark${I}isdone ; then
  2048.     MISSING="${MISSING} ${I}"
  2049.     fi
  2050. done
  2051. if test "${MISSING}" = "" ; then
  2052.     echo You have unpacked all 10 archives.
  2053.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2054. else
  2055.     echo You still need to unpack the following archives:
  2056.     echo "        " ${MISSING}
  2057. fi
  2058. ##  End of shell archive.
  2059. exit 0
  2060. -- 
  2061. Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
  2062. Mail comments to the moderator at <amiga-request@uunet.uu.net>.
  2063. Post requests for sources, and general discussion to comp.sys.amiga.
  2064.